home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
bbs
/
maxkit25.zip
/
MAXMNT25.ARJ
/
MAXMNT25.MEX
next >
Wrap
Text File
|
1996-11-15
|
23KB
|
667 lines
// ──────────────────────────────────────────────────────────────────────────
// Copyright 1995 1996 1997 by Gerry Ellison. All rights reserved.
// File: maxmnt25.mex v2.50 by Gerry Ellison 1:108/107
// Free for non-commerical use.
//
// Desc: Routine to detect and ask for Ansi.
// Desc: Routine to save and turn on hotkey.
// Desc: Routine to ask for user's gender.
// Desc: Routine to enter birth, use zeros or skip entirely
// Desc: Routine to enter a formatted voice & dataphone number.
// Desc: Routine to correct Password under six characters, or encripted.
// Desc: Routine to enter or correct City, State, Zip and Country.
//
// Thanks for phone format idea phone.mex 1.5 by David Osborne 1:243/2
// ──────────────────────────────────────────────────────────────────────────
#define INCL_global
#define INCL_max_chng
#include <max.mh>
#include <language.mh>
int: Ch, Done, Flag, SaveVideo, SaveHot;
string: Country, EnterData, TempStr;
//========================== functions ===================================
int checkansi() {
Ch := input_list("?Yn|", 0, "", "",
"\nDoes your system support "COL_YELLOW"ANSI"
COL_GRAY" screen controls");
if (Ch = 89 or Ch = 124) {
SaveVideo := TRUE;
// usr.fsr:=TRUE; // Force FSR
// usr.ibmchars:=TRUE; // Force IBM chars
// usr.cls:=TRUE; // Force CLS
// usr.bored:=0; // Force FSE
}
else if (Ch = 78) {
SaveVideo := FALSE;
usr.video := TRUE;
}
else
if (Ch = 63)
menu_cmd(609,""); //show video menu, Ansi is on at this time.
return SaveVideo;
} //end checkansi
int hotkey(int: Flag) {
if (Flag = 1) {
if (usr.hotkeys = FALSE)
menu_cmd(615,""); // Turn on Hot Keys
}
else
if (usr.hotkeys = TRUE)
menu_cmd(615,""); // Turn off Hot Keys
return SaveHot;
} //end hotkey
void gender() {
string: skeys;
skeys := str_sex_keys;
do { //begin do
Done := TRUE;
Ch := input_list("mfn", 0, "", "",
COL_GRAY"\nPlease enter your Gender: "
COL_YELLOW"M"COL_GRAY")ale, "
COL_YELLOW+"F"COL_GRAY")emale, or "
COL_YELLOW+"N"+COL_GRAY")ot Given?");
if (Ch >= 'a' and Ch <= 'z')
Ch:=Ch + 'A' - (Ch - 'a'); // Uppercase it
if (Ch=skeys[1])
usr.sex := SEX_MALE;
else if (Ch=skeys[2])
usr.sex := SEX_FEMALE;
else {
usr.sex := SEX_UNKNOWN;
print(AVATAR_UP+AVATAR_CLEOL"\rIt will be entered as "
COL_YELLOW"Gender Unknown, "COL_GRAY);
Ch := input_list("yn|", 0, "", "","Should I enter this?");
if (Ch <> 89)
Done := FALSE;
print(AVATAR_UP+AVATAR_CLEOL);
print(AVATAR_UP+AVATAR_CLEOL);
}
} //end do
while (Done <> TRUE);
} //end gender
void enterbirth() {
string: birth, choice, mask;
print(COL_GRAY"\n\aYour "COL_YELLOW"BIRTHDAY"
COL_GRAY" has not been entered or was entered incorrectly.");
Ch := input_list("yN|", 0, "", "",
"\nYear can be entered as Zeros, do you wish to enter now");
if (Ch = 89) { // start yes
print(AVATAR_UP+AVATAR_CLEOL);
EnterData := "Thanks, Please enter your BIRTHDAY: ";
mask := EnterData + "yyyy-mm-dd";
Done := False;
while (Done <> TRUE) { // Start While
birth := "";
do { // Start Do While
if (strlen(birth)=0)
birth := EnterData;
if (strlen(birth)=strlen(EnterData)+4)
birth := birth + ".";
if (strlen(birth)=strlen(EnterData)+7)
birth := birth + ".";
print("\r"COL_YELLOW+mask+COL_GRAY"\r"+birth);
choice := "0123456789";
if (strlen(birth)=(strlen(EnterData)+5))
choice := "01";
if (strlen(birth)=(strlen(EnterData)+6))
choice := "0123456789";
if (strlen(birth)=(strlen(EnterData)+8))
choice := "0123";
if (strlen(birth)=(strlen(EnterData)+9))
choice := "0123456789";
Ch := input_list(choice, CINPUT_FULLPROMPT |
CINPUT_NOLF, "", "\r"+mask+"\r"+birth, "");
birth := birth + itostr(Ch-48);
} // End Do While
while (strlen(birth)<>strlen(EnterData)+10);
birth := substr(birth,strlen(birth)-9,10);
Ch := input_list("|Yn", 0, "", "",
"You entered as your Birthday, "COL_YELLOW+birth+
COL_GRAY" is it OK to enter it?");
if (Ch = 89 or Ch = 124)
Done := TRUE;
else
print(AVATAR_UP+AVATAR_CLEOL);
} // end yes
} // End While
usr.dob := birth;
} //end enterbirth
//p
void password() {
string: mask, TempStr;
print(COL_GRAY"\n\aYour "COL_YELLOW"PASSWORD"COL_GRAY
" has not been entered or was entered incorrectly\n");
do { //begin do
EnterData := "Please enter at least a six character Password";
mask := EnterData + COL_YELLOW" ...............";
TempStr := EnterData + " ";
print("\r"COL_YELLOW+mask+COL_GRAY"\r"+TempStr);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch = 124 or Ch = ' ') {
Done := FALSE;
}
else { //else1
input_str(TempStr, INPUT_WORD | INPUT_ALREADYCH, Ch, 15, "");
if (strlen(TempStr) < 4) {
Done := FALSE;
print(AVATAR_UP+AVATAR_CLEOL);
}
else {
print(AVATAR_UP+AVATAR_CLEOL"\r"COL_GRAY"You entered a "+
itostr(strlen(TempStr))+" digit password "
COL_YELLOW+TempStr+COL_GRAY", is it OK to enter?");
Ch := input_list("yN|", 0, "", "", "");
if (Ch <> 89) {
Done := FALSE;
print(AVATAR_UP+AVATAR_CLEOL);
}
else
Done := TRUE;
}
} //end else1
} //end do
while(Done <> TRUE);
usr.pwd := TempStr;
} // end Password
//c
string getcountry() {
print(COL_GRAY"Are you calling from the, "COL_YELLOW"U"COL_GRAY"SA, "
COL_YELLOW"C"COL_GRAY"anada, or "
COL_YELLOW"A"COL_GRAY"nother country?");
Ch := input_list("Uca", 0, "", "",""); {
if (Ch = 85 or Ch = 124)
Country := "USA";
if (Ch = 67)
Country := "CND";
if (Ch = 65) { // begin enter country
string: choice, mask;
Flag := 0;
while (Flag <> 1) { //begin while
EnterData := "";
do { //begin do
mask := "";
TempStr := COL_GRAY"\rPlease enter your "
COL_YELLOW"COUNTRY"COL_GRAY" only:";
mask := TempStr + COL_YELLOW" .............";
if (strlen(EnterData) = 0)
EnterData := TempStr + " ";
print(AVATAR_UP+AVATAR_CLEOL+mask+COL_GRAY"\r"+EnterData);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch < 65 or Ch > 90) {
Done := FALSE;
print(AVATAR_DOWN);
}
else
{ //begin else1
input_str(EnterData, INPUT_LB_LINE | INPUT_ALREADYCH, Ch, 25, "");
if (strlen(EnterData) >=3)
Done := TRUE;
else
Done := FALSE;
print(AVATAR_UP+AVATAR_CLEOL);
} //end else1
} while (Done <> TRUE); //end do
print(AVATAR_CLEOL"\rYou entered as your country as "
COL_YELLOW+EnterData+ COL_GRAY", is it OK to enter");
Ch := input_list("|Yn", 0, "", "","");
if (Ch = 89 or Ch = 124)
Flag := 1;
} //end while
Country :=strupper(substr(EnterData,1,3));
} // end enter country
}
return Country;
} //end getcountry
//ph
void uscdphone(ref int: Flag) {
int: Done;
string: choice, phone, mask;
if (Flag = 'V')
TempStr := " VOICE ";
else
TempStr := " DATA ";
EnterData := "Please enter your"COL_YELLOW+TempStr+
COL_GRAY"phone number:";
while (Done <> TRUE) { //start while
mask := EnterData + " (...) ...-....";
phone := EnterData + " (";
do { //start Do
if (strlen(phone)=strlen(EnterData)+5)
phone := phone + ") ";
if (strlen(phone)=strlen(EnterData)+10)
phone := phone + "-";
print("\r"COL_YELLOW+mask+"\r"+phone);
choice := "0123456789";
if (strlen(phone)=(strlen(EnterData)+2))
choice := "23456789";
if (strlen(phone)=(strlen(EnterData)+6))
choice := "23456789";
Ch := input_list(choice, CINPUT_FULLPROMPT |
CINPUT_NOLF, "", "\r"+mask+"\r"+phone, "");
phone := phone + itostr(Ch-48);
} // End Do
while (strlen(phone)<>strlen(EnterData)+15);
print("\r",mask,"\r",phone);
print("\rYou entered,"COL_YELLOW+TempStr+
substr(phone,strlen(phone)-13,14)+
COL_GRAY", is it OK to enter");
Ch := input_list("|Yn", 0, "", "","");
if (Ch = 89 or Ch = 124)
Done := TRUE;
else
print(AVATAR_UP+AVATAR_CLEOL);
} //end while
if (Flag = 'V')
usr.phone := substr(phone,strlen(phone)-13,14);
else
usr.dataphone := substr(phone,strlen(phone)-13,14);
} //end uscdphone
//oph
void othphone(ref int: Flag) {
int: Done;
string: choice, mask, phone;
if (Flag = 'V')
TempStr := "VOICE";
else
TempStr := "DATA";
EnterData := COL_GRAY"Please enter your "COL_YELLOW+TempStr+
COL_GRAY" phone number:";
do { //begin do
mask := EnterData + COL_YELLOW"...............";
phone := EnterData + " ";
if (Flag = 'V')
TempStr := " VOICE ";
else
TempStr := " DATA ";
print(AVATAR_UP+AVATAR_CLEOL"\r"COL_YELLOW+mask+"\r"+phone);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch = 124 or Ch = ' ')
Done := FALSE;
else { //else1
if (Ch>='A' and Ch<='Z')
choice := "1234567890";
input_str(phone, INPUT_LB_LINE | INPUT_ALREADYCH, Ch, 15, "");
print(AVATAR_UP+AVATAR_CLEOL"\rYou entered,"COL_YELLOW+TempStr+phone+
COL_GRAY", is it OK to enter");
Ch := input_list("|Yn", 0, "", "","");
if (Ch = 89 or Ch = 124)
Done := TRUE;
} //end else1
} //end do
while (Done <> TRUE);
if (Flag = 'V')
usr.phone := phone;
else
usr.dataphone := phone;
} //end othphone
void dataphone(ref int: Flag) {
print("Is your "COL_YELLOW"VOICE & DATA"
COL_GRAY" phone number the same number");
Ch := input_list("yN|", 0, "", "","");
if (Ch = 89)
usr.dataphone := usr.phone;
else if (Flag <> 'O') {
Flag := 'D';
print(AVATAR_UP+AVATAR_CLEOL);
uscdphone(Flag);
}
else {
Flag := 'D';
print(AVATAR_UP+AVATAR_CLEOL);
othphone(Flag);
}
} //end dataphone
//l
void getlocation() {
int: i;
string: choice, location, mask;
print("\n");
Flag := 1;
while (Flag <> 0) { // begin redo location
print(AVATAR_CLEOL+COL_GRAY"Your "COL_YELLOW"CITY, STATE & ZIP"
COL_GRAY" has not been entered or was entered incorrectly.\n");
getcountry();
{ // begin city
string: city, c1, c2;
do {
EnterData := "";
TempStr := "";
location := "";
TempStr := COL_GRAY"\rPlease enter your "COL_YELLOW"CITY"
COL_GRAY" only:";
mask := TempStr + " .............";
if (strlen(EnterData)=0)
EnterData := TempStr + " ";
print("\r"COL_YELLOW+mask+COL_GRAY"\r"+EnterData);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch = 124 or Ch < 58)
Done := FALSE;
else { //else1
input_str(EnterData, INPUT_LB_LINE | INPUT_ALREADYCH, Ch, 25, "");
c1 := strupper(substr(EnterData,1,1));
c2 := strlower(substr(EnterData,2,stridx(EnterData,1,' ')-1));
city := strupper(substr(EnterData,stridx(EnterData,1,' ')+1,1))+
strtrim(strlower(substr(EnterData,stridx(EnterData,1,' ')+
2,strlen(EnterData))),".,");
if (c2 <> "")
city := c1+c2+city;
if (city = "Cincy" or city = "Cinti" or city = "Cin")
city := "Cincinnati";
if (strlower(city) = "ham")
city := "Hamilton";
if (strlower(city) = "cov")
city := "Covington";
if (substr(strlower(city),1,13) = "hidden valley")
city := "Hidden Valley Lk.";
if (strlower(city) = "city") {
Done := FALSE;
EnterData := "";
print(AVATAR_UP);
}
else
Done := TRUE;
} //end else1
}
while (Done <> TRUE); //end do
location := city + ", ";
} // end city
{ //begin state
string: state;
If (Country <> "CND")
state := " STATE ";
else
state := "PROVINCE";
do {
TempStr := "Please enter your "COL_YELLOW+state+
COL_GRAY" abbreviation.:";
mask := COL_GRAY+TempStr + " ..";
EnterData := TempStr + " ";
print(AVATAR_UP+AVATAR_CLEOL+"\r"COL_YELLOW+mask+
COL_GRAY"\r"+EnterData);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch = 124 or Ch < 58) {
Done := FALSE;
print(AVATAR_DOWN);
}
else { //else1
if (Ch>='A' and Ch<='Z')
input_str(EnterData, INPUT_WORD | INPUT_ALREADYCH, Ch, 2, "");
if (strlen(EnterData) <> 2) {
Done := FALSE;
}
else
Done := TRUE;
} //end else1
}
while (Done <> TRUE); //end do
location :=location + strupper(EnterData);
} //end state
//z
{ // begin all zips
string: zip;
print(AVATAR_UP+AVATAR_CLEOL);
EnterData := "\rPlease enter your "COL_YELLOW"ZIP"COL_GRAY" code:";
if (Country = "USA") { //begin USA zip
mask := EnterData + " ..........";
do { // begin Do
if (strlen(zip)=0)
zip := EnterData + " ";
if (strlen(zip) = 40)
zip := zip + "-";
print(COL_YELLOW+mask+COL_GRAY"\r"+(zip));
if (strlen(zip) <> 41)
choice := "1234567890";
else
choice := "1234567890|";
Ch := input_list(choice, CINPUT_FULLPROMPT |
CINPUT_NOLF, "", "\r"+mask+"\r"+zip, "");
if (Ch = 124)
zip := zip + "0000";
zip := zip + itostr(Ch-48);
} // End Do
while (strlen(zip) < 45);
zip := substr(zip,35,11);
} //end USA zip
else
{ // begin other then USA zip
do {
EnterData := "\rPlease enter your ZIP code:";
mask := EnterData + " ........";
zip := EnterData + " ";
print("\r"COL_YELLOW+mask+COL_GRAY"\r"+zip);
Ch:=input_ch(CINPUT_NOLF,"");
if (Ch = 124 or Ch = ' ')
Done := FALSE;
else {
if (Ch>='A' and Ch<='Z')
choice := "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
input_str(zip, INPUT_LB_LINE | INPUT_ALREADYCH, Ch, 8, "");
}
if (strlen(zip) < 6)
Done := FALSE;
else
Done := TRUE;
}
while (Done <> TRUE);
zip := " "+strupper(zip);
} // end other then USA zip
location := location+zip+" "+Country;
if (Country <> "USA")
print(AVATAR_UP+AVATAR_CLEOL);
print("You entered "COL_YELLOW+location+
COL_GRAY", is it OK to enter");
Ch := input_list("|Yn", 0, "", "","");
if (Ch = 89 or Ch = 124)
Flag := 0;
else {
Flag := 1;
EnterData := "";
if (Country <> "USA");
print(AVATAR_UP+AVATAR_CLEOL);
for (i := 1; i < 3; i := i + 1) {
print(AVATAR_UP+AVATAR_CLEOL);
}
}
} // begin redo location
usr.city := location;
} // end all zips
} //end getlocation
//m=========================================================================
int main(string: argv) { // Begin Main Procedue
int: loop;
string: mask, choice;
SaveVideo := usr.video;
if(ansi_detect()=TRUE)
if (usr.video = FALSE) {
usr.video := TRUE;
checkansi();
}
SaveHot := usr.hotkeys; // Save Hot Key setting │
Flag :=1; //turn on kotkey
hotkey(Flag);
If (usr.sex = SEX_UNKNOWN)
gender(); //ask gender
if (usr.dob = "1900.00.00" or usr.dob = "0000.00.00") // begin birthday
enterbirth(); // begin birthday.
// Uncomment in Max.ctl "No Password Encryption" then switch the two lines
// below. It will ask for a new unencryption password.
// if (strlen(usr.pwd) < 6 or usr.encrypted = TRUE)
if (strlen(usr.pwd) < 6) // begin Password
password();
if (strlen(usr.dataphone) <9 or strlen(usr.dataphone) <> 14 or
strlen(usr.phone) <9 or strlen(usr.phone) <> 14)
{ //begin voice & dataphone
print(COL_GRAY"\nYour "COL_YELLOW" PHONE NUMBER"COL_GRAY
" has not been entered or was entered incorrectly.\n");
getcountry();
if (Country <> "OTH") { // begin US & Canada phone
if (strlen(usr.phone) <> 14)
{
Flag := 'V';
uscdphone(Flag);
}
if (strlen(usr.dataphone) <> 14)
{
Flag := 'D';
dataphone(Flag);
}
} //end US & Canada phone
if (Country = "OTH") // begin OTH phone
{
if (strlen(usr.phone) <10)
{ // begin OTH voicephone
Flag := 'V';
othphone(Flag);
}
if (strlen(usr.dataphone) <10)
{ // begin OTH dataphone
Flag := 'O';
dataphone(Flag);
}
} // end OTH dataphone
} //end voice & dataphone
if (strlen(usr.city) <24) // begin city state zip
getlocation();
// ────────────────────────────── Restore Key ──────────────────────────────
usr.video := SaveVideo; // Restore video setting
usr.hotkeys := SaveHot; // Restore hotkey setting
return 0;
} // End Main Procedue
//////////////////////////////////////////////////////////////////////////
// Not in program
// ─────────────────────────────── RIP ─────────────────────────────────────
/// if(rip_detect()=TRUE)
/// ch := input_list("Yn?", 0, "", "",
/// "\nDoes your system support Remote Imaging Protocol (RIP) ");
/// if (ch = 63)
/// display_file("C:\\Max\\Misc\\Why_ANSI.bbs", nonstop);
/// ch := input_list("Yn?", 0, "", "",
/// "\nDoes your system support Remote Imaging Protocol (RIP) ");
/// if (ch = 89)
/// usr.rip := TRUE; // Force RIP on
// ────────────────────────────── Editor ───────────────────────────────────
// Use the MaxEd full-screen editor [Y,n,?=help]?
/// ch := input_list("Yn?", 0, "", "",
/// "\nD0 you use the MaxEd full-screen editor?");
/// if (ch = 63)
/// display_file("C:\\Max\\Misc\\Why_FSED.bbs", nonstop);
/// if (ch = 78)
/// usr.bored:=0; // Force bored
/// else
/// usr.fsr:=TRUE; // Force FSR
// ────────────────────────────── IBM-PC ───────────────────────────────────
// Use IBM-PC characters [Y,n,?=help]?
/// ch := input_list("Yn?", 0, "", "", "\nDo you use IBM-PC characters?");
/// if (ch = 63)
/// display_file("C:\\Max\\Misc\\Why_PC.BBS", nonstop);
/// if (ch <> 89)
/// usr.ibmchars:=TRUE; // Force IBM chars
//..////////////////////////////////////////////////////////////////////////
// if (argv <> "UPDATE") {
// char: nonstop;
// nonstop := 0;